{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ac6d354e-c1ad-40bd-8c6a-6645622c6e38",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2]\n",
      " [3 4]\n",
      " [5 6]]\n",
      "[[10 20]\n",
      " [30 40]\n",
      " [50 60]]\n",
      "[[ 1  2 10 20]\n",
      " [ 3  4 30 40]\n",
      " [ 5  6 50 60]]\n",
      "[[ 1  2]\n",
      " [ 3  4]\n",
      " [ 5  6]\n",
      " [10 20]\n",
      " [30 40]\n",
      " [50 60]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "n1=np.array([[1,2],[3,4],[5,6]])\n",
    "# 创建第二个数组\n",
    "n2=np.array([[10,20],[30,40],[50,60]])\n",
    "print(n1)\n",
    "print(n2)\n",
    "# 水平方向增加数据\n",
    "print(np.hstack((n1,n2)))\n",
    "# 垂直方向增加数据\n",
    "print(np.vstack((n1,n2)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "abac83b3-774d-4687-b843-60d29aff9b63",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2]\n",
      " [3 4]\n",
      " [5 6]]\n",
      "[[1 2]\n",
      " [3 4]]\n",
      "[[2]\n",
      " [4]\n",
      " [6]]\n",
      "[[1 2]]\n"
     ]
    }
   ],
   "source": [
    "# 数组的删除操作\n",
    "n1=np.array([[1,2],[3,4],[5,6]])\n",
    "print(n1)\n",
    "# 删除第三行\n",
    "n2=np.delete(n1,2,axis=0)  # 2行索引为2的轴是0\n",
    "print(n2)\n",
    "# 删除第一列\n",
    "n3=np.delete(n1,0,axis=1)\n",
    "print(n3)\n",
    "# 删除第二行和第三行\n",
    "n4=np.delete(n1, (1,2), axis=0)\n",
    "print(n4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1c37d3b5-0623-4057-89b1-28c52e13c7d4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2]\n",
      " [3 4]\n",
      " [5 6]]\n",
      "[[ 1  2]\n",
      " [30 40]\n",
      " [ 5  6]]\n",
      "[[ 1  2]\n",
      " [30 40]\n",
      " [ 5 87]]\n"
     ]
    }
   ],
   "source": [
    "# 数组的修改操作\n",
    "n1=np.array([[1,2],[3,4],[5,6]])\n",
    "print(n1)\n",
    "n1[1]=[30, 40]\n",
    "print(n1)\n",
    "# 改某一个具体的数据\n",
    "n1[2][1]=87\n",
    "print(n1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "7f004c74-b493-4a36-84cd-63a715d60f47",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 1  2  3  4  5  6  7  8  9 10]\n",
      "(array([5, 6, 7, 8, 9]),)\n",
      "[ 6  7  8  9 10]\n"
     ]
    }
   ],
   "source": [
    "# 数组的查询操作\n",
    "n=np.arange(1,11)\n",
    "print(n)\n",
    "n1=np.where(n>5)\n",
    "print(n1)\n",
    "n2=n[np.where(n>5)]\n",
    "print(n2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "47bebbdc-a940-4988-bce5-f760c28d3ad0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9d357235-6e3a-4d5b-93c6-04475b0c5e7e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6bdb0ec1-118f-4a9b-b58e-66e7c521eafb",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8ebbea97-0423-4c3a-b48b-f62a1c2377ae",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a01f3905-2fff-478c-960e-0920d4602805",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "25c846c2-7be2-4cc1-a92a-3aeb38757a29",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eeb02071-2809-4372-b943-ba93bbf329cd",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6441b838-2cc9-4691-a296-c8bf67dffb00",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cda6aa51-a0f7-42df-9c9f-b4260c8ac825",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a48ac93c-9477-473f-b4d5-d4a705cd6ac4",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d13fe80b-ff76-4c8a-ae43-27ce9368ec3b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
